package sword.T42;

/**
 * @File Info: leetcode -- <Solution>
 * @Author: 18362
 * @Create: 2022-03-10 13:23:52 星期四
 */

/**
 * 同53
 */
class Solution {
    public int maxSubArray(int[] nums) {
        int result = nums[0];
        for(int i=1; i<nums.length; ++i) {
            nums[i] = Math.max(nums[i], nums[i-1]+nums[i]);
            result = Math.max(result, nums[i]);
        }
        return result;
    }
}